package org.huang.sample02;

import org.huang.sample02.bean.SampleBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

/**
 * @描述: 这是通过代码来配置bean
 * @作者 Mr.Huang
 * @创建时间 2017-08-07
 * @版本: 1.0
 */
@Configuration  //@Configuration注解该类，等价 与XML中配置beans；用@Bean标注方法等价于XML中配置bean
@ImportResource("classpath:bean.xml")
public class ConfigurationDemo1 {

    //等价于XML中配置bean
    @Bean
    public SampleBean getBean(){
        return new SampleBean(1,"zhangsan");
    }


}
